// axios二次封装
import axios from 'axios'
// create an axios instance
const fetch = axios.create({
  // baseURL: process.env.NODE_ENV === 'development' ? 'http://localhost:8878' : 'http://wct.lihexinzhiye.com',
  //上线用这个
  baseURL:  'http://gjjava.lihexinzhiye.com',//管家系统服务器后端   域名接口路径
  timeout: 50000
})
// request请求拦截器
fetch.interceptors.request.use(
  config => {
    const token = localStorage.getItem('token')
    token && (config.headers.token = token)
    return config
  }, error => {
    Promise.reject(error)
  })

axios.defaults.withCredentials = true
export default fetch


//调用后端微信接口预支付并拿到pay_id等参数,前端使用pay_id调用微信支付
export function WxPay(form){
  return fetch ({
    url:'/WeiXinPay/WxPay',
    method:'post',
    dataType:"json",
    data:form,
  })
}


//获取启效云居家管理系中的创客老师列表
export function SelectTeacherData() {
  return fetch({
    url: '/QiXiaoData/Teacher',
    method: 'get'
  })
}

//公众号查询明细
export function SelectDetail(subData) {
  return fetch({
    url: '/login/SelectDetail?' + subData,
    method: 'get'
  })
}


//公众号二维码
export function SelectCode(subData) {
  return fetch({
    url: '/QRCode/SelectDetail?' + subData,
    method: 'get'
  })
}

// 获取验证码
export function getDesignatedVerificationCode(subData) {
  return fetch({
    url: '/QRCode/getDesignatedVerificationCode?' + subData,
    method: 'get'
  })
}

//微信支付成功页面的参数获取
export function selectPaySuc(subData) {
  return fetch({
    url: '/QRCode/selectPaySuc?' + subData,
    method: 'get'
  })
}


//推荐创客老师
export function TuiJianF(form){
  return fetch ({
    url:'/TuiJian/TuiJianF',
    method:'post',
    dataType:"json",
    data:form,
  })
}


